package com.y.game;

import javax.swing.JFrame;

import com.y.game.emtity.Ground;
import com.y.game.emtity.ShapeFactory;
import com.y.game.listener.GameListener;
import com.y.game.view.GamePanel;

public class Main {
	
	public static void main(String[] args) {
		// 游戏面板
		GamePanel gamePanel = new GamePanel();
		Ground ground = new Ground();
		ShapeFactory shapeFactory = new ShapeFactory();
		
		GameListener l = new GameListener(gamePanel, shapeFactory, ground);
		
		JFrame f = new JFrame();
		f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		f.setSize(gamePanel.getSize().width + 20, gamePanel.getSize().height + 40);
		f.addKeyListener(l);
		f.add(gamePanel);
		f.setVisible(true);
		
		l.newGame();
		
	}
}

